home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 11822 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.1 KB

  1. Path: tank.news.pipex.net!pipex!iol!not-for-mail
  2. From: goyra@iol.ie (David Byrden)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Explicit copy constructor calls illegal?
  5. Date: 16 Mar 1996 11:38:15 GMT
  6. Organization: Ireland On-Line
  7. Distribution: world
  8. Message-ID: <4ie977$h9j@nuacht.iol.ie>
  9. References: <4i9tp8$fgt@reznor.larc.nasa.gov> <00001a81+0000ad4e@msn.com> <4ic1f4$a3p@reznor.larc.nasa.gov>
  10. NNTP-Posting-Host: joyce.iol.ie
  11. X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
  12.  
  13. lance@jitter.larc.nasa.gov wrote:
  14. : By the way, an explicit call to the CC or any constructor IS possible, and
  15. : is done routinely, just not the way I was trying to do it :)  I have used
  16. : the copy constructor in lieu of an overloaded operator=, like
  17. :        MyClass Myclass1;
  18. :        int Myclass1.IMyClass(/*member values, etc. */);
  19. :        MyClass Myclass2(Myclass1);  // Kind of an explicit CC call.
  20.  
  21. Well, it's explicit all right, but it is firmly tied to the creation
  22. of the object "Myclass2" so it's not possible to use it to, say,
  23. re-initialise an existing object. 
  24.  
  25.                                        David
  26.  
  27.